<template>
  <div  class="box" v-tuo></div>
</template>
<script>
export default {
  directives: {
    tuo: {
      mounted(el) {
        console.log(el);
        el.onmousedown = function (e) {
          el.onmousemove = function (e) {
            el.style.marginLeft = e.clientX - el.offsetWidth / 2 + "px";
            el.style.marginTop = e.clientY - el.offsetHeight / 2 + "px";
          };
        };
        el.onmouseup = function (e) {
          el.onmousemove = null;
        };
      },
    },
  }, 
  
};
</script>
<style>
.box {
  width: 200px;
  height: 200px;
  background: blue;
}
</style>
